package com.jp.knowledge.adapter.team_circle;


import android.content.Context;
import android.support.annotation.NonNull;
import android.widget.ImageView;

import com.jp.knowledge.R;
import com.jp.knowledge.my.base.RecycleVAdapter;
import com.jp.knowledge.my.base.RecycleVHolder;
import com.jp.knowledge.util.ImageLoadUtil;

import java.util.List;

public class TeamCircleCreateImageAdapter extends RecycleVAdapter<String>{

    public TeamCircleCreateImageAdapter(Context context, @NonNull List<String> list) {
        super(context, list);
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.team_circle_item_image;
    }

    @Override
    public void onBind(RecycleVHolder holder, int position) {
        ImageView imageView = holder.getImageView(R.id.team_circle_item_image);
        if(position == mList.size()-1){
            imageView.setImageResource(R.mipmap.achievements);
        } else{
            ImageLoadUtil.load(mContext, mList.get(position), imageView);
        }
    }

    @Override
    public void updateAdapter(@NonNull List<String> list) {
        mList.clear();
        mList.addAll(list);
        mList.add("");
        notifyDataSetChanged();
    }
}
